﻿using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
using Nasty.Core.Log;
using Nasty.Core.Registry;

namespace Nasty.Core.Filter
{
    public class GlobalExceptionFilter : IAutofacExceptionFilter
    {
        private readonly ILogger<GlobalExceptionFilter> _logger;

        public GlobalExceptionFilter(ILogger<GlobalExceptionFilter> logger)
        {
            _logger = logger;
        }

        public void OnException(ExceptionContext context)
        {
            SerilogLogger.LogError($"信息:{context.Exception.Message},来源:{context.Exception.StackTrace}");
        }
    }
}
